import React from 'react';
import { Button } from 'antd';
import { WeaDialog ,WeaLocaleProvider} from 'ecCom';
import { observer } from 'mobx-react';
const getLabel = WeaLocaleProvider.getLabel;
import "./index.less";
@observer
export default class NewAppGroupDialog extends React.Component {
    render() {
        const { store } = this.props;
        const {visible, onCancel, submiting, form, onSave } = store.newAppGroupDialog;
        const buttons = [
            <Button type='primary' icon={submiting && 'loading'} disabled={submiting} onClick={onSave}>{getLabel(502708,'确定')}</Button>,
            <Button type='ghost' onClick={onCancel}>{getLabel(31129,'取消')}</Button>
        ];
        return (
            <WeaDialog
                title={`新建分组`}
                icon={"icon-coms02-Data-center"}
                iconBgcolor="#1a57a0"
                style={{ height: 200 }}
                visible={visible}
                buttons={buttons}
                onCancel={onCancel}
            >
                {form.render({ needTigger: false, col: 1 },{onChange:this.onChange.bind(this)})}
            </WeaDialog>
        )
    }

    // 周期数值发生变化时触发回调
    onChange(data) {
        var cycle = data["cycle"];
        if(cycle !== undefined) {
            const { store } = this.props;
            const {baseDateHide} = store;
            var value = cycle.value;
            store.updateCondition(false,value);
            
        }
      
    }
}